#pragma once
#include "ray.h"

enum CAMERA_MOVE_CTR
{
	emMoveUp,
	emMoveDown,
	emMoveLeft,
	emMoveRight,
};
#define MOVE_STEP 0.2

class camera
{
public:
	camera()
	{
		lower_left_corner = vec3(-2.0, -1.0, -1.0);
		horizontal = vec3(4.0, 0.0, 0.0);
		vertical = vec3(0.0, 2.0, 0.0);
		origin = vec3(0.0, 0.0, 0.0);
	}

	ray get_ray(float u, float v)
	{
		return ray(origin, lower_left_corner + u * horizontal + v * vertical - origin);
	}

	void camera_move(CAMERA_MOVE_CTR ctr)
	{
		vec3 vec3Move = vec3(0, 0, 0);
		switch (ctr)
		{
		case emMoveUp:
			vec3Move = vec3(0, 0, -MOVE_STEP);
			break;
		case emMoveDown:
			vec3Move = vec3(0, 0, MOVE_STEP);
			break;
		case emMoveLeft:
			vec3Move = vec3(MOVE_STEP, 0, 0);
			break;
		case emMoveRight:
			vec3Move = vec3(-MOVE_STEP, 0, 0);
			break;
		default:
			break;
		}
		origin += vec3Move;
	}

	vec3 origin;
	vec3 lower_left_corner;
	vec3 horizontal;
	vec3 vertical;
};